package hiatao.puzzle.activity;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.view.View.OnClickListener;

import java.util.ArrayList;

import haitao.puzzle.R;
import hiatao.puzzle.adapter.MyFragmentPagerAdapter;
import hiatao.puzzle.fragment.CommentFragment;
import hiatao.puzzle.fragment.RankFriendsFragment;
import hiatao.puzzle.utils.StatusBarCompat;
import hiatao.puzzle.widget.PagerSlidingTabStrip;

public class CommentActivity  extends FragmentActivity {

	private PagerSlidingTabStrip tabs;
	private ViewPager pager;
	CommentFragment commentFragment;
	CommentFragment sixinFragment;
	RankFriendsFragment friendsFragment;
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    	super.onCreate(savedInstanceState);
    	setContentView(R.layout.activity_comment); 
		findViews();
		StatusBarCompat.compat(this, getResources().getColor(R.color.primary));
    }
	protected void findViews() {
		pager = (ViewPager) findViewById(R.id.pager);
		tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);
		commentFragment = new CommentFragment();
		sixinFragment = new CommentFragment();
		ArrayList<Fragment> fragments = new ArrayList<Fragment>();
		fragments.add(commentFragment);
		fragments.add(sixinFragment);
		final String[] titles = {"私信","评论"};
		pager.setAdapter(new MyFragmentPagerAdapter(getSupportFragmentManager(), fragments, titles));
		tabs.setViewPager(pager);
		tabs.setShouldExpand(true);
		findViewById(R.id.top_back).setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				CommentActivity.this.finish();
			}
		});
	}

}
